-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(log): document FileHandler #6175
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6175 +/- ##
=======================================
Coverage 96.51% 96.52%
=======================================
Files 538 538
Lines 41276 41302 +26
Branches 6162 6162
=======================================
+ Hits 39837 39865 +28
+ Misses 1395 1393 -2
Partials 44 44 ☔ View full report in Codecov by Sentry. |
/** Opened file to append logs to. | ||
* @example Usage | ||
* ```ts no-assert | ||
* import { FileHandler } from "@std/log/file-handler"; | ||
* | ||
* const handler = new FileHandler("INFO", { filename: "./logs.txt" }); | ||
* handler.setup(); | ||
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state | ||
* handler.flush(); // Manually flushes the buffer | ||
* handler.destroy(); // Closes the file and removes listeners | ||
* ``` | ||
* **/ | ||
[fileSymbol]: Deno.FsFile | undefined; | ||
/** Buffer used to write to file. | ||
* @example Usage | ||
* ```ts no-assert | ||
* import { FileHandler } from "@std/log/file-handler"; | ||
* | ||
* const handler = new FileHandler("INFO", { filename: "./logs.txt" }); | ||
* handler.setup(); | ||
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state | ||
* handler.flush(); // Manually flushes the buffer | ||
* handler.destroy(); // Closes the file and removes listeners | ||
* ``` | ||
* **/ | ||
[bufSymbol]: Uint8Array; | ||
/** Current position for pointer. | ||
* @example Usage | ||
* ```ts no-assert | ||
* import { FileHandler } from "@std/log/file-handler"; | ||
* | ||
* const handler = new FileHandler("INFO", { filename: "./logs.txt" }); | ||
* handler.setup(); | ||
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state | ||
* handler.flush(); // Manually flushes the buffer | ||
* handler.destroy(); // Closes the file and removes listeners | ||
* ``` | ||
* **/ | ||
[pointerSymbol] = 0; | ||
/** Filename associated with the file being logged. | ||
* @example Usage | ||
* ```ts no-assert | ||
* import { FileHandler } from "@std/log/file-handler"; | ||
* | ||
* const handler = new FileHandler("INFO", { filename: "./logs.txt" }); | ||
* handler.setup(); | ||
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state | ||
* handler.flush(); // Manually flushes the buffer | ||
* handler.destroy(); // Closes the file and removes listeners | ||
* ``` | ||
* **/ | ||
[filenameSymbol]: string; | ||
/** Current log mode. | ||
* @example Usage | ||
* ```ts no-assert | ||
* import { FileHandler } from "@std/log/file-handler"; | ||
* | ||
* const handler = new FileHandler("INFO", { filename: "./logs.txt" }); | ||
* handler.setup(); | ||
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state | ||
* handler.flush(); // Manually flushes the buffer | ||
* handler.destroy(); // Closes the file and removes listeners | ||
* ``` | ||
* **/ | ||
[modeSymbol]: LogMode; | ||
/** File open options. | ||
* @example Usage | ||
* ```ts no-assert | ||
* import { FileHandler } from "@std/log/file-handler"; | ||
* | ||
* const handler = new FileHandler("INFO", { filename: "./logs.txt" }); | ||
* handler.setup(); | ||
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state | ||
* handler.flush(); // Manually flushes the buffer | ||
* handler.destroy(); // Closes the file and removes listeners | ||
* ``` | ||
* **/ | ||
[openOptionsSymbol]: Deno.OpenOptions; | ||
/** Text encoder. | ||
* @example Usage | ||
* ```ts no-assert | ||
* import { FileHandler } from "@std/log/file-handler"; | ||
* | ||
* const handler = new FileHandler("INFO", { filename: "./logs.txt" }); | ||
* handler.setup(); | ||
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state | ||
* handler.flush(); // Manually flushes the buffer | ||
* handler.destroy(); // Closes the file and removes listeners | ||
* ``` | ||
* **/ | ||
[encoderSymbol]: TextEncoder = new TextEncoder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these symbols should probably be private properties, but since they are not, linting requires them to be documented still. I'm not sure how to handle this better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably that's the issue of linter (and it could be also an issue of doc generator), but I think it's fine for now for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Documents
FileHandler
for #3764